import { ref } from "vue";
import { defineStore } from "pinia";
import { getToken } from "@/utils/public";

interface UserInfo {
	adminType: number;
	cloudMenus: any[];
	headImg: string | null;
	name: string;
	phone: string;
	token: string;
	userId: string;
	username: string;
}
export const userUserStore = defineStore("user", () => {
	// 用户信息
	const user_info = ref<UserInfo>((getToken() || {}) as UserInfo);
	const setUserInfo = (data: any) => {
		user_info.value = data;
		console.log("user_info", user_info.value);
	};
	console.log("user_info", user_info.value);

	return {
		user_info,
		setUserInfo,
	};
});
